#ifndef ABSTRACTFACTORY_H
#define ABSTRACTFACTORY_H
#include <iostream>

using namespace std;
class Fruit{
public:
    virtual ~Fruit()=0;
    virtual void sayname()=0;
};

class FruitFactory{
public:
    virtual Fruit* getApple()=0;
    virtual Fruit* getBanana()=0;
    virtual ~FruitFactory()=0;
};

class SouthBanana:public Fruit{
public:
    virtual void sayname() {
        cout<<"South Banana"<<endl;
    }
};

class SouthApple:public Fruit{
public:
    virtual void sayname(){
        cout<<"South Apple"<<endl;
    }
};

class NorthBanana:public Fruit{
public:
    virtual void sayname() {
        cout<<"North Banana"<<endl;
    }
};

class NorthApple:public Fruit{
public:
    void sayname(){
        cout<<"North Apple"<<endl;
    }
};

class SouthFruitFactory:public FruitFactory{
public:
    Fruit *getApple(){
        return new SouthApple;
    }
    Fruit *getBanana(){
        return new SouthBanana;
    }
};

class NorthFruitFactory:public FruitFactory{
public:
    Fruit *getApple(){
        return new NorthApple;
    }
    Fruit *getBanana(){
        return new NorthBanana;
    }
};

#endif // ABSTRACTFACTORY_H

